4.6 Canonical ensemble ======================